import time
from selenium.webdriver.common.by import By
from autoframe.common.base import Base
from common.functions import open_browser


class LoginPage(Base):
    login_url = 'https://ecshop.test2.shopex123.com/user.php'

    def input_username(self, username):
        self.send_keys((By.NAME, 'username'), username)

    def input_password(self, password):
        self.send_keys((By.NAME, 'password'), password)

    def login(self):
        self.click((By.CLASS_NAME, 'loginbtn'))


if __name__ == '__main__':
    browser = open_browser()
    login = LoginPage(browser)
    login.get('https://ecshop.test2.shopex123.com/user.php')
    login.input_username('fine1')
    login.input_password('123456')
    time.sleep(3)
    login.login()
    login.quit()
